//
//  ZSDefenseTableViewController.m
//  ZhuShou
//
//  Created by Dejun Liu on 15/11/3.
//  Copyright © 2015年 jw. All rights reserved.
//

#import "ZSDefenseTableViewController.h"
#import "ZSNoneTableViewCell.h"

@interface ZSDefenseTableViewController ()
@property (nonatomic,strong) NSArray *list;
@end

@implementation ZSDefenseTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.list = @[@{
                      @"title":@"回家",
                      @"value":@""
                      },
                  @{
                      @"title":@"离家",
                      @"value":@""
                      },
                  @{
                      @"title":@"休息",
                      @"value":@""
                      },
                  @{
                      @"title":@"撤防",
                      @"value":@""
                      }
                  ];
    [self.tableView registerNib:[UINib nibWithNibName:@"ZSNoneTableViewCell" bundle:nil] forCellReuseIdentifier:@"Cell"];
    
    
    //    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(requestData:)];
    //    self.tableView.header = header;
    //
    //    MJRefreshAutoStateFooter *footer = [MJRefreshAutoStateFooter footerWithRefreshingTarget:self refreshingAction:@selector(requestData:)];
    //    self.tableView.footer = footer;
    //
    //    [self.tableView.header beginRefreshing];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.list.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *identifier = @"Cell";
    ZSNoneTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    NSDictionary *dic = [self.list objectAtIndex:indexPath.row];
    cell.textLabel.text = [dic objectForKey:@"title"];
    cell.detailTextLabel.text = [dic objectForKey:@"value"];
    //    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    
    return cell;
}

//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    return 44.0f;
//}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

#pragma mark RequestData

- (void)requestData:(MJRefreshHeader *) commponent
{
    [self.tableView.header endRefreshing];
    [self.tableView.footer endRefreshing];
    [self.tableView.footer noticeNoMoreData];
}

@end
